/**
 * 
 */
package org.shanktech.tshare.binlogsync.facotry;

import org.shanktech.tshare.binlogsync.process.parser.ObjectParser;
import org.shanktech.tshare.binlogsync.util.SqlUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TableParserFactory {

  private static final Logger LOGGER = LoggerFactory.getLogger(TableParserFactory.class);
  
  public static ObjectParser getInstance(String tableName) {
    ObjectParser parser = null;
    try {
      return (ObjectParser) Class.forName("org.shanktech.tshare.binlogsync.process.parser.object."
          + SqlUtil.tableNameToClassName(tableName) + "Parser").newInstance();
    } catch (Exception e) {
      LOGGER.error("ObjectParser get instance exception! tablename = {} ", tableName, e);
    }
    return parser;
  }
}
